using System.IO;

namespace FileTransfer.Lib{
	public static class DirectoryInfoExtensions{
		public static FileInfo GetChild(this DirectoryInfo source, string childName){
			string path = Path.Combine(source.FullName, childName);
			return new FileInfo(path);
		}

		public static FileInfo GetNewExtension(this FileInfo source, string newExtension){
			string path = Path.GetDirectoryName(source.FullName);
			string oldName = Path.GetFileNameWithoutExtension(source.FullName);
			return new FileInfo(Path.Combine(path,oldName +  newExtension));
		}
	}
}